<template>
  <div class="list-view">
    任务业务逻辑666
    <el-button type="primary" :icon="Plus" @click="toAdd">新建任务</el-button>
  </div>
</template>

<script setup lang="ts">
import { useTaskStore } from "../store/taskStore";
import { Plus } from "@element-plus/icons-vue";
import { routerLinkTestView } from "../api/task/index";

defineOptions({
  name: "TaskView",
  components: {}
});

const dataEvent = (data: any) => {
  console.log("子组件收到数据了", data);
}

defineExpose({
  dataEvent
})

// 2. 实例化组合式 store
const taskStore = useTaskStore();

// 验证存储结果
console.log("存储后 Pinia 中的值：", taskStore.sendTaskCmd);

const toAdd = async () => {
  // router.push("/addTask");
  console.log("跳转新建任务");
  await routerLinkTestView("/addTask");
};
</script>

<style lang="scss" scoped>
.list-view {
  padding: 12px;
}
</style>
